package com.core.database;

import java.sql.Connection;
import java.sql.DriverManager;

public class ConnectionFactory {
	// create connection to contact database
	// (if you see this class please execute contacts.sql and change username
	// and password of your sql )
	static Connection createConnection() {
		try {
			return DriverManager.getConnection(
					"jdbc:mysql://localhost:3306/contact", "root", "root");
		} catch (Exception ex) {
			ex.printStackTrace();
			throw new RuntimeException(ex.getMessage(), ex);
		}
	}

	// define mysql driver
	static {
		try {
			Class.forName("com.mysql.jdbc.Driver");
		} catch (Exception ex) {
			ex.printStackTrace();
			throw new RuntimeException(ex.getMessage(), ex);
		}
	}

}
